//****************************************************************************
// File Name: WineryManager.h
// Wine Tours project
// Group #2: Allen McLennan, Ryan Neal, Mike Matz
// CS 1C
// April 28, 2010
// Definition of WineryManager class
//****************************************************************************

#ifndef WINERYMANAGER_H_
#define WINERYMANAGER_H_

#include "Winery.h"
#include "config.h"
#include <vector>
#include <fstream>
#include <iomanip>

class WineryManager {
public:
	WineryManager(const char *fileName);
	virtual ~WineryManager();

	Winery *GetWinery(int id);
	bool SaveWinery(Winery *w, int id);
	int GetNumWineries();
	bool ImportWineries(const char *importFileName);
	void ResetWineries();
	void DisplayWineries();

private:
	// Data file name
	char *fileName;

	// Track whether file has been initialized
	bool initialized;

	// Number of wineries
	int numWineries;

	// Verify that data file exists; if not, initialize
	bool VerifyFile();

	// Initialize data file
	bool InitializeFile();

	// Private method to loop through wineries and determine total count
	void UpdateNumWineries();
};

#endif /* WINERYMANAGER_H_ */
